package cn.uniqueww;

import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import redis.clients.jedis.Jedis;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author: uniqueww
 * @since: 2022-11-28 15:12
 **/

@Slf4j
public class ceshi {

    @Test
    public void jedisTest(){
        Jedis jedis = new Jedis("localhost", 6379);

        jedis.set("name","xiaoming");
        jedis.get("name");

        Map<String, String> map = new HashMap<>();
        map.put("name","xiaohu");
        map.put("sex","nan");
        map.put("age","18");
        jedis.hset("person","name","xiaohu");

        Map<String, String> person = jedis.hgetAll("person");
        log.info("person->{}",person);

        Set<String> keys = jedis.keys("*");
        keys.forEach(x->{
            System.out.println(x);
        });
    }
}
